Unlike for-loop , the while loop is used when the number of iterations is unknown. The while loop will execute a program several times until the condition is false.
Syntax
Example
Output
Infinitive while Loop
The while loop will execute infinite time when we pass the true value as the condition. If you want to exit from the infinite loop, press ctrl+c .
Syntax
Example
Output